import React from 'react';
import {inject, observer} from 'mobx-react';
import { Route, withRouter, Switch } from 'react-router-dom';
import { Form, RouteLayout, SelectPage } from 'weaver-mobile-page';
import { Icon , List, InputItem, Modal , Tools } from 'weaver-mobile';
import ReceiptForm from './member/receiptForm'
import Decision from './decision/index'
import { toJS } from 'mobx';
import Remind from './remind';
import RoomPlan2 from '../../components/roomPlan/roomDisplay2';
import { isIOS } from '../../util/util';
const alert = Modal.alert;
const getLabel = Tools.getLabel;
const { FormItem } = List;
const isIPhone = new RegExp('\\biPhone\\b|\\biPod\\b', 'i').test(window.navigator.userAgent);

@inject('viewMeetingStore')
@withRouter
@observer
class BaseView extends React.Component {
  constructor(props) {
      super(props);
      this.state = {
        remindTargetId: '',
        hasCaller: false,
        preViewUrl:'',
        imgKeyIndex:{}
      };
    }
    componentDidMount() {
      //刷新用
      let { setState, is_create, type, meetingId} = this.props.viewMeetingStore;
      type = type?type:sessionStorage.getItem('type')
      meetingId = meetingId?meetingId:sessionStorage.getItem('meetingId')?sessionStorage.getItem('meetingId'):'';
      setState({'prePathName':this.props.location.pathname,type:type,meetingId:meetingId})
      if(type === 'create') {
        is_create && this.getDetail();
        setState({is_create: false})
      }else{
        type !== 'edit' && this.getDetail(); // 解决编辑时重复请求覆盖之前填写的数据
      }

      if(window.iNoBounce && window.iNoBounce.isEnabled()) {
        isIOS() && window.iNoBounce.disable(); // 解决ios滑动问题
      }
      window.openLink&&window.openLink.browserOpenLink&&window.openLink.browserOpenLink.set({
        meetingCaller: (v) => {
          window.openLink && typeof window.openLink.openHrm === 'function' && window.openLink.openHrm(v.id);
        }
      });
    }

    componentWillReceiveProps (nextProps) {
      const {getBaseDetail , setState} = this.props.viewMeetingStore;
      if(getBaseDetail){
        this.getDetail();
        setState({getBaseDetail:false})
      }
    }

    getDetail = ()=>{
      let {getPreview, meetingId ,type , roomPlanSelectDate, begintime , endtime , isfromchatshare , sharer, roomid, createParams, setState } = this.props.viewMeetingStore;
      
      //加一个callback作用是编辑复制的时候调整会议室和自定义会议地点的必填非必填
      let params = {};
      
      params.meetingid = meetingId
      if(roomPlanSelectDate){
        params.meetingDate = roomPlanSelectDate
        params.begintime = begintime
        params.endtime = endtime
      }else{
        params.meetingDate = sessionStorage.meetingSelectdate
      }
      if(isfromchatshare === 1 || isfromchatshare === '1'){
        params.isfromchatshare = isfromchatshare
        params.sharer = sharer
      }
      if(roomid !== '') {
        params.address = roomid;
      } 
      if(createParams['type']=='create'){
        params={...createParams}
        setState({createParams:{}})
      }
      getPreview({...params},(type === 'edit' || type === 'create' || type === 'change')?this.editCondition:'')
      this.setOnLoading();
    }

    onclick = (e) => {
      this.setState({remindTargetId: e})
      this.props.history.push('/calendar/detail/index/remind')
    }

    getDataKey = (data, type, domkey) => {
      const { form, setState, checkBoxSelectpageValue } = this.props.viewMeetingStore;
      let key = [];
      let va = {};
      data && data.forEach(res => {
        key.push(res.key)
      })
      va = key.toString()
      if(type === 'checkBox') {
        let keys = {
          ...checkBoxSelectpageValue,
          [domkey]: key
        };
        setState({ checkBoxSelectpageValue: keys });
        form.updateField(domkey,va)
      } else {
        form.updateField('remindTypeNew',va)
        setState({remidOptions: key})
      }
    }

    getFields = () => {
      let { form , type , getFormBrowserType, ecCallerVisible, selectPage, remidOptions, checkBoxSelectpageStore, checkBoxSelectpageValue,uploadParams} = this.props.viewMeetingStore;
      const { isInit ,conditioninfo } = form;
      const groups = [];
      let values = form.formParams
      //获取form中的值,来判断
      //1:提醒方式是否显示
      //2:会议地点和自定义会议地点显示哪一个
      let remindValueTemp = '';
      checkBoxSelectpageValue = toJS(checkBoxSelectpageValue);
      isInit && conditioninfo.length!==0 && conditioninfo.forEach((group) => {
        const fields = [];
        group.items.forEach((field) => {
          //---------    提醒方式如果没有选择的话那么就不显示相关提醒信息    --------start
          //手机端查看情况下，都是采用input形式展示
          if(((values['remindTypeNew'] && values['remindTypeNew'] === getLabel(19782, '不提醒') ) && getFormBrowserType('remindTypeNew') === 'INPUT')  &&
            (field.domkey[0] === 'remindImmediately' ||
            field.domkey[0] === 'remindBeforeStart' ||
            field.domkey[0] === 'remindBeforeEnd')){//----查看情况下的显示------
                return;
          }else if(((values['remindTypeNew'] === '' || values['remindTypeNew'] === undefined) && getFormBrowserType('remindTypeNew') !== 'INPUT')  &&
            (field.domkey[0] === 'remindImmediately' ||
            field.domkey[0] === 'remindBeforeStart' ||
            field.domkey[0] === 'remindBeforeEnd')){//----新建编辑情况下的显示------
                return;
          }else if(values['remindTypeNew'] !== '' && (field.domkey[0] === 'remindBeforeStart')){
            if(values['remindBeforeStart'] === '0' || values['remindBeforeStart'] === '' ){
              remindValueTemp = getLabel(19782, '不提醒')
            }else if(values['remindHoursBeforeStart'] !== '0' && values['remindHoursBeforeStart'] !== '' && (values['remindTimesBeforeStart'] === '0' || values['remindTimesBeforeStart'] === '')){
              remindValueTemp = `${values['remindHoursBeforeStart']}${getLabel(391, '小时')}`
            //出现正点的时候判断大于等于0
            }else if((values['remindHoursBeforeStart'] === '0' || values['remindHoursBeforeStart'] === '') && values['remindTimesBeforeStart'] >= '0'){
              remindValueTemp = `${values['remindTimesBeforeStart']}${getLabel(15049, '分钟')}`
            }else if(values['remindHoursBeforeStart'] !== '0' && values['remindHoursBeforeStart'] !== '' && values['remindTimesBeforeStart'] !== '0' && values['remindTimesBeforeStart'] !== ''){
              remindValueTemp = `${values['remindHoursBeforeStart']}${getLabel(391, '小时')} ${values['remindTimesBeforeStart']}${getLabel(15049, '分钟')}`
            }
            fields.push(
              <FormItem 
                key={field.domkey[0]}
                label={field.label}
                wrap="nowrap"
                line
                border
                content={(<InputItem id="starttimebefore" editable={false} onClick={(e) => type!=='view'?this.onclick('starttimebefore'):''} value={remindValueTemp} />)}
                extra={[<Icon key="right" type="right" onClick={(e) => type!=='view'?this.onclick('starttimebefore'):''}/>]}
              />
            );
            return;
          }else if(values['remindTypeNew'] !== '' && ( field.domkey[0] === 'remindBeforeEnd')){
            if(values['remindBeforeEnd'] === '0' || values['remindBeforeEnd'] === '' ){
              remindValueTemp = getLabel(19782, '不提醒')
            }else if(values['remindHoursBeforeEnd'] !== '0' && values['remindTimesBeforeEnd'] === '0'){
              remindValueTemp = `${values['remindHoursBeforeEnd']}${getLabel(391, '小时')}`
            //出现正点的时候判断大于等于0
            }else if(values['remindHoursBeforeEnd'] === '0' && values['remindTimesBeforeEnd'] >= '0'){
              remindValueTemp = `${values['remindTimesBeforeEnd']}${getLabel(15049, '分钟')}`
            }else if(values['remindHoursBeforeEnd'] !== '0' && values['remindTimesBeforeEnd'] !== '0'){
              remindValueTemp = `${values['remindHoursBeforeEnd']}${getLabel(391, '小时')} ${values['remindTimesBeforeEnd']}${getLabel(15049, '分钟')}`
            }
            fields.push(
              <FormItem
                key={field.domkey[0]}
                label={field.label}
                wrap="nowrap"
                line
                border  
                content={(<InputItem id="endtimebefore" editable={false} onClick={(e) => type!=='view'?this.onclick('endtimebefore'):''} value={remindValueTemp} />)}
                extra={[<Icon key="right" type="right" onClick={(e) => type!=='view'?this.onclick('endtimebefore'):''} />]}
              />
            );
            return;
          //当是非查看的情况下根据hasCaller过滤显示的组件,注意在编辑的情况下要先从后台根据会议类型取得是否有召集人
          }else if (ecCallerVisible && field.domkey[0] === 'caller_hrm' && type !== 'view') {
            if(this.state.hasCaller){
              return false;
            }
          }else if (ecCallerVisible && field.domkey[0] === 'caller' && type !== 'view') {
            if(!this.state.hasCaller){
              return false;
            }
          //当是查看情况下的时候只走caller组件,不走caller_hrm组件
          }else if(ecCallerVisible && field.domkey[0] === 'caller_hrm' && type === 'view'){
            return false;
          }
          //---------    提醒方式如果没有选择的话那么就不显示相关提醒信息    --------end

          //提醒方式如果没有选择的话那么就不显示相关提醒信息
          //---------    查看会议的时候如果选择会议室的时候那么就不显示自定义会议室,反之亦然    --------start
          if(values['address'] === '' && type === 'view' && (field.domkey[0] === 'address')){
                return;
          }
          if((values['customizeAddress'] === '' || values['customizeAddress'] === "" || values['customizeAddress'] === undefined) && type === 'view' && (field.domkey[0] === 'customizeAddress')){
                return;
          }
          
          //---------    查看会议的时候如果选择会议室的时候那么就不显示自定义会议室,反之亦然    --------end
          if(field.conditionType === 'UPLOAD'){
            let uploadUrl = '';
            const uploadParamsTemp = toJS(uploadParams)
            if(uploadParamsTemp && Object.keys(uploadParamsTemp).length > 0){
              uploadUrl = uploadParamsTemp[field.domkey[0]]&&uploadParamsTemp[field.domkey[0]].uploadUrl || ''
              if(uploadUrl&&field.listType == 'img' && uploadUrl.indexOf('listType=img') < 0){
                uploadUrl = uploadUrl+"&listType=img"
                field = {...field,...uploadParams[field.domkey[0]],uploadUrl:uploadUrl}
              }else{
                field = {...field,...uploadParams[field.domkey[0]]}
              }
            }
            // field = {...field,...uploadParams[field.domkey[0]]}
          }
          field = toJS(field);
          if(type !== 'view' && field.domkey[0] === 'remindTypeNew') {
            fields.push(
              <SelectPage
                key={'remindTypeNew'}
                options={field.options}
                store={selectPage}
                label={field.label}
                valueArray={remidOptions}
                multiChoose
                onChange={(datas) => {this.getDataKey(datas)}}
              />
            );
          } else if(type !== 'view' && field.conditionType === "SELECT" && field.detailtype == 2 && checkBoxSelectpageStore[field.domkey[0]]) {
            fields.push(
              <SelectPage
                key={field.domkey[0]}
                viewAttr={field.viewAttr}
                options={field.options}
                store={checkBoxSelectpageStore[field.domkey[0]]}
                label={field.label}
                valueArray={checkBoxSelectpageValue[field.domkey[0]]}
                multiChoose
                onChange={(datas) => {this.getDataKey(datas, 'checkBox', field.domkey[0])}}
              />
            );
          } else {
            fields.push(<Form.Item
              key={field.domkey.join('__')}
              form={form}
              fieldConfig={field}
              onChange={this.onChange.bind(this)}
              extra = {field.domkey[0]==='address'?<div style={{color:'#55B1F9',marginLeft:'22px',height:'20px'}} onClick={(e)=>this.openRoomPlan(e)}><span>{getLabel(15881,"会议室使用情况")}</span></div>:''}
            />);
          }
        });
        groups.push(
          // 分组
          <div className='fold-group' key={group.title}>
            <div className='fold-title' onClick={() => {this.handleToggle(group.title, !group.show)}}>
              {group.title}
              <Icon className="flod-icon" type={group.show ? 'up' : 'down'} />
            </div>
            <div className={`${group.show ? 'show' : 'hide'}`}>
              {fields}
            </div>
          </div>
        )
      });
      
      return groups;
    }

    handleToggle = (...arg) => {
      const {groupToggleForm} = this.props.viewMeetingStore;
      groupToggleForm(...arg);
    }

    browserDemand = (oldFields, oldValue)=>{
      const { meetingId , type } = this.props.viewMeetingStore;
      let newFields = {...oldFields}
      let newValue = {...oldValue}
      if(oldFields.domkey[0] == 'address'){
        newFields.browserConditionParam.dataParams = {...newFields.browserConditionParam.dataParams,beginDate: oldValue['begindate'],beginTime:oldValue['begintime'],endDate: oldValue['enddate'],endTime:oldValue['endtime'],meetingid:type=='change'?meetingId:''}
        newFields.browserConditionParam.completeParams = {...newFields.browserConditionParam.completeParams,beginDate: oldValue['begindate'],beginTime:oldValue['begintime'],endDate: oldValue['enddate'],endTime:oldValue['endtime'],meetingid:type=='change'?meetingId:''}
      }
      newFields.browserConditionParam.dataParams = {...newFields.browserConditionParam.dataParams,secretLevel: newValue['secretLevel'] ? newValue['secretLevel'] : ''}
      newFields.browserConditionParam.completeParams = {...newFields.browserConditionParam.completeParams,secretLevel: newValue['secretLevel'] ? newValue['secretLevel'] : ''}
      return newFields
    }

    editCondition = (isInit)=>{
      const { form , hasCaller, ecCallerVisible } = this.props.viewMeetingStore;
      const { conditioninfo } = form;
      let values = form.formParams

      if(isInit){
        this.setState({hasCaller:hasCaller})
      }
      //判断会议类型
      let conditioninfoTemp = toJS(conditioninfo);
      let retconditioninfo = [];
      let groups = {};
      conditioninfoTemp.length!==0 && conditioninfoTemp.forEach((group) => {
        let fields = []
        group.items.forEach((field) => {
          if (field.domkey[0] === 'meetingtype') {//会议类型在搜索时要多传个参数
            field.browserConditionParam.dataParams = {isInterval: '0'}
          }else if (ecCallerVisible && field.domkey[0] === 'caller') {//会议类型-召集人直接的联动，在搜索时要多传个参数
            if(this.state.hasCaller){
              field.browserConditionParam.dataParams = {meetingtype: values['meetingtype'] ? values['meetingtype'] : ''}
              field.browserConditionParam.completeParams = {meetingtype: values['meetingtype'] ? values['meetingtype'] : ''}
              field.browserConditionParam.tabs = []
            }
          }else if (field.domkey[0] === 'address') {
            if(values['address'] === '' && values['customizeAddress'] === undefined){
              field.browserConditionParam = {...field.browserConditionParam,viewAttr:3};
              field = {...field, rules: '',viewAttr: 3};
            }else if(values['address'] === '' && values['customizeAddress'] !== ''){
              field.browserConditionParam = {...field.browserConditionParam,viewAttr:2};
              field = {...field, rules: '',viewAttr: 2};
            }else if(values['address'] === '' && values['customizeAddress'] === ''){
              field.browserConditionParam = {...field.browserConditionParam,viewAttr:3};
              field = {...field,rules:'required',viewAttr:3};
            }
          }else if (field.domkey[0] === 'customizeAddress') {
            if(values['customizeAddress'] === '' && values['address'] !== ''){
              field = {...field,viewAttr:2,rules:''};
            }else if(values['address'] === '' && values['customizeAddress'] === ''){
              field = {...field,viewAttr:3,rules:'required'};
            }
          }else if (field.domkey[0] === 'hrmmembers' || field.domkey[0] === 'hrmDepartments' || field.domkey[0] === 'hrmSubCompanys') {
            // let hasValue = values['hrmmembers'] || values['hrmDepartments'] || values['hrmSubCompanys'] 
            // if(hasValue){
            //   field.browserConditionParam = {...field.browserConditionParam,viewAttr:2};
            //   field = {...field, rules: '',viewAttr: 2};
            // }else{
            //   field.browserConditionParam = {...field.browserConditionParam,viewAttr:3};
            //   field = {...field, rules: '',viewAttr: 3};
            // }
          }
          if(field.conditionType == 'BROWSER'){
            field = this.browserDemand(field, values)
          }

          fields.push(field)
        })
        groups = {...group,items:fields}
        retconditioninfo.push(groups)
      })
      form.setState({conditioninfo:retconditioninfo})
    }

    onChange = (paramsObj,value) => {
      const domkey = paramsObj.domkey[0];
      const { form , changeBroserMeetingType,setOldSecretLevel,oldSecretLevel,baseDocFlowColumn,ecCallerVisible, setState, setUploadParams, 
        setUploadCommonParams,uploadKeys,uploadParams, setAccessoryBaseInfo, isLimitCreateMeetingBeginEndTime } = this.props.viewMeetingStore;
      let { topic_data, topicDocFlowColumn, serivce_data, serviceDocFlowColumn } = this.props.viewMeetingStore;
      const values = form.formParams
      if (domkey === 'hrmmembers' || domkey === 'hrmDepartments' || domkey === 'hrmSubCompanys') {
        if(domkey === 'hrmmembers'){
          form.updateField('totalmember',value.length)
        }
        form.updateField(domkey,value)
        this.editCondition();
      }else if(domkey === 'begindate' || domkey === 'begintime' || domkey === 'enddate' || domkey === 'endtime' || domkey === 'secretLevel'){
        form.updateField(domkey,value)
        this.editCondition();
      }else if(domkey === 'crmmembers'){
        form.updateField('crmtotalmember',value.length)
      }else if(uploadKeys.indexOf(domkey) > -1){
        form.updateField(domkey,value)
        setUploadParams({
          [domkey]: {
            datas: value
          }
        })
      }else if(domkey === 'meetingtype'){
        let canChange = true;
        uploadKeys.map(key => {//上传附件字段是否已经有值的判断，有就不需要改了
          if(uploadParams[key].datas.length !== 0){
            canChange = false
          }
        })
        let params = ecCallerVisible ? {
          caller: values.caller,
          hrmmembers: values.hrmmembers,
          crmmembers: values.crmmembers,
          meetingtype: value&&value.length>0?value[0].id:'',
        } : {
          hrmmembers: values.hrmmembers,
          crmmembers: values.crmmembers,
          meetingtype: value&&value.length>0?value[0].id:'',
        };
        changeBroserMeetingType(params).then((result)=>{
          this.setState({
            hasCaller: result.hasCaller,
          })
          if ( ecCallerVisible ) {
            if (result.caller.length > 0 && result.hasCaller) {//召集人
              form.updateField('caller',result.caller)
              form.updateField('caller_hrm',result.caller)
            }else if (result.caller.length > 0 && !result.hasCaller){
              //为了手机端和PC端显示的会议类型关联召集人浏览按钮一致,meetingcaller和1要相互转换
              form.updateField('caller',result.caller)
              form.updateField('caller_hrm',result.caller)
            }else{
              form.updateField('caller',[])
              form.updateField('caller_hrm',[])
            }
          }

          if (result.hrmmembers.length > 0) {//参会人员
            form.updateField('hrmmembers',result.hrmmembers)
          }else{
            form.updateField('hrmmembers',[])
          }
          if (result.crmmembers.length > 0) {//参会客户
            form.updateField('crmmembers',result.crmmembers)
          }else{
            form.updateField('crmmembers',[])
          }
          form.updateField('totalmember',result.hrmmembers.length)
          form.updateField('crmtotalmember',result.crmmembers.length)
          if(result.uploadcfg && Object.keys(result.uploadcfg).length > 0 && canChange){//相关附件(3个条件)
            setUploadCommonParams({
              category: result.uploadcfg.category || '',
              maxUploadSize: Number(result.uploadcfg.maxUploadSize) || 0,
              mixUploadSize: Number(result.uploadcfg.mixUploadSize) || 0,
              uploadUrl: result.uploadcfg.uploadUrl,
              errorMsg: result.uploadcfg.errorMsg || '',
            })
            setAccessoryBaseInfo({
              category: result.uploadcfg.category || '',
              maxUploadSize: Number(result.uploadcfg.maxUploadSize) || 0,
              mixUploadSize: Number(result.uploadcfg.mixUploadSize) || 0,
              uploadUrl: result.uploadcfg.uploadUrl,
              errorMsg: result.uploadcfg.errorMsg || '',
            })
          }
          this.editCondition();
        })
      }else if (domkey === 'address') {//输入会议室内容 清空自定义会议室内容
        value !== '' && form.updateField('customizeAddress', '')
        form.updateField(domkey,value)
        this.editCondition();
      }else if (domkey === 'customizeAddress') {//输入自定义会议室内容 清空会议室内容
        value !== '' && form.updateField('address', '')
        form.updateField(domkey,value)
        this.editCondition();
      }else if (ecCallerVisible && (domkey === 'caller' || domkey === 'caller_hrm') ) {
        form.updateField('caller', [{id:toJS(value)[0].id,name:toJS(value)[0].name}]);
        form.updateField('caller_hrm', [{id:toJS(value)[0].id,name:toJS(value)[0].name}])
      }
      // 开始---结束时间限制
      if(isLimitCreateMeetingBeginEndTime) {
        if(domkey === 'begindate' && value !=='' && value >= values.enddate){
          if(value === values.enddate && values.begintime >  values.endtime) {
            form.updateField('endtime',values.begintime);
          }else{
            form.updateField('enddate', value);
          }
          this.editCondition();
        }
        if(domkey === 'enddate' && value !=='' && value <= values.begindate){
          if(value === values.begindate && values.begintime >  values.endtime) {
            form.updateField('begintime',values.endtime);
          }else{
            form.updateField('begindate',value);
          }
          this.editCondition();
        }
        if(domkey ==='begintime' && (values.begindate >= values.enddate) && (value > values.endtime)){
          form.updateField('endtime',value)
          this.editCondition();
        }
        if(domkey ==='endtime' && value!='' &&  (values.begindate >= values.enddate) && (value < values.begintime)){
          form.updateField('begintime',value)
          this.editCondition();
        }
      }
      
      //因为密级弹出框取消时要将选择的数据还原成之前数据--议程和服务现在还不支持(组件)
      if (domkey === 'secretLevel') {
        //密级等级是否小于当前使用等级
        const secretLevel = value
        if(parseInt(secretLevel,10) > parseInt(oldSecretLevel,10)){
          alert(getLabel(15172, '系统提示'), getLabel(500701,'【密级】级别已更改且小于上次选择，文档、流程资源会被清空'), [
            { 
              text: getLabel(386789,'取消'), 
              onPress: () => {
                form.updateField(domkey,oldSecretLevel)
              },
               style: 'default' },
            { 
              text: getLabel(386788,'确定'), 
              onPress: () => { 
                form.updateField(domkey,value)
                setOldSecretLevel(value)
                
                topic_data = toJS(topic_data);
                topicDocFlowColumn = toJS(topicDocFlowColumn);
                serivce_data = toJS(serivce_data);
                serviceDocFlowColumn = toJS(serviceDocFlowColumn);
                const clearValue = (datas, domkeys) => { // 清空文档和流程字段中的数据
                  let temp_datas = [];
                  Array.isArray(datas) ? temp_datas = datas.map(e => {
                    let eObj = e;
                    Array.isArray(domkeys) && domkeys.forEach(key => {
                      eObj = {
                        ...eObj,
                        [key]: '',
                        [`${key}span`]: '',
                      }
                    });
                    return eObj;
                  }) : null;

                  return temp_datas;
                }
                const temp_topic_data = clearValue(topic_data, topicDocFlowColumn);
                const temp_service_data = clearValue(serivce_data, serviceDocFlowColumn);
                setState({ topic_data: temp_topic_data, serivce_data: temp_service_data });

                baseDocFlowColumn.forEach((element,index)=>{
                  form.updateFields({
                    [element]:{value: [{
                      id:'',
                      name:''
                    }]},
                  });
                })
              }},
          ]);
        }else{
          form.updateField(domkey,value)  
          setOldSecretLevel(value)
        }
      }else{
        form.updateField(domkey,value)
      }
      
      
    }

    getLoading = () => {
      return (
        <div className='loaidng-icon' key='loading' style={{position: 'fixed', left: '50%', top: '50%'}}>
          <Icon type='loading' size='lg'/>
        </div>
      );
    }

    render() {
      const { type,noRight, noData, form:{isInit} ,btns, loadding} = this.props.viewMeetingStore;
      return (
        <div className={btns&&btns.length===1&&btns[0]==='doViewLog'?"tabContentHeight2":'tabContentHeight'}>
          {
          <div style={{height:`100%`}} className={'baseFormDiv'}>
          {isInit && this.getFields()}
          {loadding && this.getLoading()}
          </div>
          }
          <RouteLayout.Frame
            id="viewframe"
            path="/calendar/detail/index/viewdoc"
            iframeProps={{
              src: this.state.preViewUrl,
            }}
          />
          <Switch>
            <Route
              key="receiptForm"
              path="/calendar/detail/index/receiptForm"
              render={()=>(
                <RouteLayout>
                <div key="receiptFormDiv" className="wm-route-layout wm-demo-route-layout-page">
                  <ReceiptForm  />
                </div>
                </RouteLayout>
              )}
            />
            <Route
              key="remind"
              path="/calendar/detail/index/remind"
              render={()=>(
                <RouteLayout>
                <div key="remindDiv" className="wm-route-layout wm-demo-route-layout-page">
                  <Remind  remindTargetId={this.state.remindTargetId}/>
                </div>
                </RouteLayout>
              )}
            />
            <Route
              key="decisoin"
              path="/calendar/detail/*/decision"
              render={()=>(
                <RouteLayout>
                <div key="decisoinDiv" className="wm-route-layout wm-demo-route-layout-page route-div-height">
                  <Decision />
                </div>
                </RouteLayout>
              )}
            />
            <Route
              key="roomPlan"
              path="/calendar/detail/index/roomPlan"
              render={()=>(
                <RouteLayout>
                <div key="roomPlanDiv" className="wm-route-layout wm-demo-route-layout-page">
                  <RoomPlan2 />
                </div>
                </RouteLayout>
              )}
            />
          </Switch>
        </div>
        )
    }


    openRoomPlan = (e)=>{
      const { form } = this.props.viewMeetingStore;
      let values = form.formParams
      e.stopPropagation;
      this.props.history.push({pathname:'/calendar/detail/index/roomPlan',query:{selectDate:values.begindate}})
    }

    setOnLoading = (flg=false)=> {
      const { setState } = this.props.viewMeetingStore;
      setState({onLoading:flg})
    }
}

export default BaseView;